﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.DAL.EF.DAO;
using Mail.Model;
using System.Data.Objects;
using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;
using System.Data.SqlServerCe;
using System.Collections;

namespace Core.DAL.EF
{
    public class UserCategoryDAO : RepositoryBase<User_Category>
    {
        public UserCategoryDAO() { }

        public List<User_Category> FindByUserId(int? userId)
        {
            return context.Database
                .SqlQuery<User_Category>("select * from User_CategorySet where UserId = @param"
                , new SqlParameter("@param", userId)).ToList();
        }

        public List<User_Category> FindByCategoryId(int? catedoryId)
        {
            var l = context.Database
               .SqlQuery<User_Category>("select UserId,CatedoryId from User_CategorySet");
               //, new SqlCeParameter { ParameterName = "param", Value = catedoryId });
           
            return l.ToList();
        }
    }
}
